#ifndef QTUI_QT_PACKAGE_VIEW_BASE_HPP
#define QTUI_QT_PACKAGE_VIEW_BASE_HPP

#include "QtUI/QtUIConfig.hpp"
#include "AbsUI/PackageView.hpp"
#include <boost/noncopyable.hpp>

namespace QtUI
{

namespace Impl { class QtPackageViewImpl; }

/// @ingroup QtUI
/// @brief It adapts AbsUI::PackageView interface to QT framework.
///
/// For more details, see @ref ViewMechanisms_QtIntegration "Integration of view mechanisms in QT framework"
class QTUI_API QtPackageViewBase: public AbsUI::PackageView, private boost::noncopyable
{
	friend class Impl::QtPackageViewImpl;
public:
	/// @sa AbsUI::PackageView::PackageView
	QtPackageViewBase( Ctrl::PackageController& ctrler);

	/// @brief It deletes the implementation object.
	virtual ~QtPackageViewBase();

	/// @brief It handles the event signaled when a new package is added.
	/// 
	/// It emits the signal from the implementation object.
	virtual void addNewPackage( Model::Package* pParentPackage, Model::Package* pNewPackage);

	/// @brief It handles the event signaled when an existing package is removed.
	///
	/// It emits the signal from the implementation object.
	virtual void removePackage( Model::Package* pParentPackage, Model::Package* pRemovedPackage);

	/// @brief It handles the case when a root requirement is added to a package.
	///
	/// It emits the signal from the implementation object.
	virtual void addRootRequirement( Model::Package* pParent, Model::Requirement* pAddedRequirement);

	/// @brief It handles the case when an existing root requirement is removed from a package.
	///
	/// It emits the signal from the implementation object.
	virtual void removeRootRequirement( Model::Package* pParent, Model::Requirement* pRemovedRequirement);

protected:
	/// @brief It handles the add package event. Subclasses should specialize this method.
	///
	/// This handler is called asynchronously, in the UI thread.
	virtual void handlePackageAdded( Model::Package* pParentPackage, Model::Package* pNewPackage) = 0;
	
	/// @brief It handles the remove package event. Subclasses should specialize this method.
	///
	/// This handler is called asynchronously, in the UI thread.
	virtual void handlePackageRemoved( Model::Package* pParentPackage, Model::Package* pRemovedPackage) = 0;

	/// @brief It handles the added root requirement event. Subclasses should specialize this method.
	///
	/// This handler is called asynchronously, in the UI thread.
	virtual void handleRootRequirementAdded( Model::Package* pParent, Model::Requirement* pAddedRequirement) = 0;


	/// @brief It handles the removed root requirement event. Subclasses should specialize this method.
	///
	/// This handler is called asynchronously, in the UI thread.
	virtual void handleRootRequirementRemoved( Model::Package* pParent, Model::Requirement* pRemovedRequirement) = 0;

private:
	Impl::QtPackageViewImpl* pImpl_;
};

} // namespace QtUI

#endif // QTUI_QT_PACKAGE_VIEW_BASE_HPP